<?php

namespace app\index\controller;

use app\admin\model\Ssal as ModelSsal;
use app\common\controller\Frontend;


class Ssal extends Frontend
{

    protected $noNeedLogin = '*';
    protected $noNeedRight = '*';
    protected $layout = '';

    public function index()
    {
       //查询新闻，每页显示条数
       $list = ModelSsal::where('status',1)->paginate(9);
       //获取分页显示
       $page = $list->render();
       //模板变量赋值
       $this->assign('list',$list);
       $this->assign('page',$page);
       return $this->view->fetch();
    }

    public function info()
    {
        $id = input('id');
        $newsinfo = ModelSsal::where('status',1)->where('id',$id)->find();
        //上一条
        $pre_id = ModelSsal::where('status',1)->where("id", "<", $id)->limit('1')->find();
        //下一条
        $next_id = ModelSsal::where('status',1)->where("id", ">", $id)->limit('1')->find();
        //模板变量赋值
        $this->assign('info',$newsinfo);
        $this->assign('pre',$pre_id);
        $this->assign('next',$next_id);
        //渲染页面
        return $this->view->fetch();
    }
}
